<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html">
        <h:form>
            <h:outputText style="font-weight: bold" value="Enter the validity period for this quotation(in days): " />
            <h:inputText required="true" requiredMessage="Field is required." id="daysValid" value="#{quotationBean.daysValid}">
            </h:inputText>
            <br></br>
            <br></br>

            <h:outputText style="font-weight: bold" value="Choose a client from the table below:" />
            <h:selectOneMenu value="#{quotationBean.clientId}">
                <f:selectItems value="#{quotationBean.clients}" var="c"
                               itemLabel="#{c.id}. #{c.companyName} - #{c.name} [#{c.clientStatus}]" itemValue="#{c.id}" />
            </h:selectOneMenu>


            <h:dataTable cellpadding="3px" cellspacing="16px" styleClass="allaroundborder" headerClass="allaroundborder" columnClasses="allaroundborder" 
                         rowClasses="allaroundborder" value="#{quotationBean.clients}" var="client">

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Client Id" />
                    </f:facet>
                    <h:outputText value="#{client.id}" />
                </h:column>    

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Name" />
                    </f:facet>
                    <h:outputText value="#{client.name}" />
                </h:column>    

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Company Name" />
                    </f:facet>
                    <h:outputText value="#{client.companyName}" />
                </h:column>    

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Company Address" />
                    </f:facet>
                    <h:outputText value="#{client.companyAddress}" />
                </h:column>    

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Business Type" />
                    </f:facet>
                    <h:outputText value="#{client.businessType}" />
                </h:column> 

            </h:dataTable>
            <h:commandButton action="index.xhtml" value="Cancel" />
            <br/><br/>
            <h:commandButton action="addQuotationItem.xhtml" value="Add a quotation item" actionListener="#{quotationBean.addNewQuotation}" />
        </h:form>
</ui:composition>
